//
//  FGYMyViewController.m
//  01 - shop
//
//  Created by ma c on 16/8/17.
//  Copyright (c) 2016年 beijing. All rights reserved.
//

#import "FGYMyViewController.h"
#import "FGYHeadView.h"
#import "FGYMYTableView.h"
#import "FGYLangViewController.h"

@interface FGYMyViewController ()

@property (strong, nonatomic) FGYHeadView * headView;
@property (strong, nonatomic) FGYMYTableView * FGYtableView;


@end

@implementation FGYMyViewController
- (FGYHeadView *)headView{
    if (!_headView) {
        _headView = [[FGYHeadView alloc]init];
    }
    return _headView;
}
#pragma mark -
#pragma mark - 抽出的tableView;
- (FGYMYTableView *)FGYtableView{
    if (!_FGYtableView) {
        _FGYtableView = [[FGYMYTableView alloc]initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
        _FGYtableView.backgroundColor = MainColor;
    }
    
    return _FGYtableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.FGYtableView];
    [self.view addSubview:self.headView];
    self.edgesForExtendedLayout = 0;
    [self addAutoLayout];
    
    __weak typeof(self)weakSelf = self;
    
    self.headView.pushBlock = ^(){
        FGYLangViewController * langVC = [[FGYLangViewController alloc]init];
        [weakSelf.navigationController pushViewController:langVC animated:YES];
    };
    
    self.view.backgroundColor = MainColor;
}

- (void)addAutoLayout{
    __weak typeof(self)weekSelf = self;
    [_headView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(weekSelf.view);
        make.width.equalTo(@150);
    }];
    
    [_FGYtableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(weekSelf.view);
        make.top.equalTo(weekSelf.headView.mas_bottom).offset(35);
        make.height.equalTo(@200);
    }];
    
    
}
@end
